package com.maochd.cloud.api.file.service;

import com.maochd.cloud.api.file.config.MultipartSupportConfig;
import com.maochd.cloud.api.file.fallback.RemoteFileFallbackFactory;
import com.maochd.cloud.common.core.constant.ServiceContextConstant;
import com.maochd.cloud.common.core.constant.ServiceNameConstant;
import com.maochd.cloud.common.core.domain.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(contextId = ServiceContextConstant.FILE_CONTEXT_ID,
        value = ServiceNameConstant.FILE_SERVER,
        fallbackFactory = RemoteFileFallbackFactory.class, configuration = MultipartSupportConfig.class)
public interface RemoteFileService {

    @PostMapping("/upload/inner")
    @ApiOperation(value = "内部上传（feign）", notes = "内部上传（feign）")
    R<String> uploadInner(@RequestPart("file") MultipartFile file,
                          @RequestParam(value = "filename", required = false) String filename);

}
